import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class HomeWork {
    public static void main12(String[] args) {
        LinkedList<Integer> list = new LinkedList<>();
        list.add(5);
        list.add(6);

        System.out.println(list);
    }
    public static void main11(String[] args) {
        String s1 = "welcome to bit";
        String s2 ="come";
        ArrayList<Character> list = new ArrayList<>();
        for (int i = 0; i < s1.length(); i++) {
            char s = s1.charAt(i);
            if (!s2.contains(s + "")) {
                list.add(s1.charAt(i));
            } else {
                continue;
            }
        }
        for (char i:list) {
            System.out.print(i);
        }
    }
    public static void main(String[] args) {
        String s1 = "welcome to bit";
        String s2 ="come";
        StringBuilder sb = new StringBuilder();
        char[] ss1 = s1.toCharArray();
        char[] ss2 = s2.toCharArray();
        for (int i = 0; i < ss1.length; i++) {
            if(!Arrays.toString(ss2).contains(ss1[i] +"")) {
                sb.append(ss1[i]+"");
            }else if(ss1[i] == ' '){
                sb.append(ss1[i]+"");
            }  else {
                continue;
            }
        }
        System.out.println(Arrays.toString(ss2));
        System.out.println(sb.toString());
    }
    public static String main9(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        StringBuilder sb = new StringBuilder();
        char[] ss = s.toCharArray();
        char[] ss2 = new char[ss.length];
        int count = 0;
        for (int i = 0; i < ss.length; i++) {
            for (int j = 0; j < ss2.length; j++) {
                if (count == 0) {
                    ss2[count] = ss[i];
                    count++;
                } else {
                    if (ss2[j] != ss[i]) {
                        ss2[count] = ss[j];
                        count++;
                    } else {
                        continue;
                    }
               }
            }
        }
        for(int i = 0;i < ss2.length;i++) {
            sb.append(ss2[i]);
        }
        return sb.toString();

    }
    public static boolean func2(int[] array) {
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            if(array[i] % 2 != 0) {
                count++;
                if(count == 3) {
                    return true;
                }
            }else {
                count = 0;
            }
        }
        return false;
    }
    public static void main10(String[] args) {
        int[] array = {1,3,4,5,7,9,10};
        boolean a = func2(array);
        System.out.println(a);
    }
    public static int findnumber(int[] array) {
        int tmp = array[0];
        int count = 0;
        for (int i = 0; i < array.length; i++) {
            if(array[i] == tmp) {
                count++;
            } else  {
                count--;
            }
            if(count == 0) {
                tmp = array[i];
                count++;
            }
        }
        return tmp;
    }
    public static void main7(String[] args) {             //找出一个数中出现次数最多的数
        int[] array = {2,2,1,1,1,2,2};
        int ret =findnumber(array);
        System.out.println(ret);
    }
    public static int findNum(int[] array) {
        int ret = 0;
        for (int i = 0; i < array.length; i++) {
            ret ^= array[i];
        }
        return ret;
    }
    public static void main6(String[] args) {
        int[] array = {1,1,2,2,3,3,4};
        int a = findNum(array);
        System.out.println(a);
    }
    public static int[] func(int[] array,int target) {
        int[] array1 = {-1,-1};
        for (int i = 0; i < array.length; i++) {
            for (int j = 1; j < array.length; j++) {
                if(array[i] + array[j] == target) {
                    array1[0] = i;
                    array1[1] = j;
                    return array1;
                }
            }
        }
        return array1;
    }
    public static void main5(String[] args) {
        int[] array = {1,10,3,4,5};
        int[] ret = func(array,4);
        System.out.println(Arrays.toString(ret));
    }
    public static void bubbleSort(int[] array) {                 //冒泡排序
        for (int i = 0; i < array.length-1; i++) {   //趟数
            boolean flg = true;
            for (int j = 1; j < array.length-i; j++) {
                if(array[j-1] > array[j]) {
                    int tmp = array[j-1];
                    array[j-1] = array[j];
                    array[j] = tmp;
                    flg = false;
                }
            }
            if(flg == true) {
                return;
            }
        }
    }
    public static void main4(String[] args) {
        int[] array = {4,3,2,1,0};
        bubbleSort(array);
        System.out.println(Arrays.toString(array));
    }
    public static int binarySearch(int[] array,int key) {         //二分查找
        int left = 0;
        int right = array.length-1;
        int mid;
        while (left <= right) {
            mid = (left+right)/2;
            if(array[mid] < key) {
                left = mid+1;
            }else if(array[mid] >key) {
                right = mid-1;
            }else {
                return mid;   //找到返回下标
            }
        }
        return -1;    //找不到返回-1
    }
    public static void main3(String[] args) {
        int[] array = {1,2,3,4,5,6,7,8,9,10,11,12};
        System.out.println(binarySearch(array, 10));

    }

    public static void adjustNum(int[] array) {
        int left = 0;
        int right = array.length-1;
        while (left < right) {
            for (left = 0; left < right; left++) {
                if(array[left] % 2 == 0) {
                    break;
                }
            }
            for (right = array.length-1;right > left;right--) {
                if(array[right] % 2 != 0) {
                    break;
                }
            }
            int tmp = array[left];
            array[left] = array[right];
            array[right] = tmp;
        }
    }
    public static void main2(String[] args) {
        int[] array = {1,2,3,4,5,6};
        adjustNum(array);
        System.out.println(Arrays.toString(array));
    }
    public static void transform(int[] array) {
        for (int i = 0; i < array.length; i++) {
            array[i] = 2*array[i];
        }
    }
    public static void main1(String[] args) {
        int[] array = {1,2,3};
        transform(array);
        System.out.println(Arrays.toString(array));
    }
}
